<%@ page contentType="text/html; charset=UTF-8" language="java"
	import="java.sql.*" errorPage=""%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
		<title>登陆界面</title>
		<link rel="stylesheet" type="text/css" href="css/login.css" />
		<script language="javascript">
				function showCompany()
				{
					var a=document.getElementById("company");
					if(a.style.display=="block")
					{
						a.style.display="none";
					}
					else{a.style.display="block";} 
				}
		</script>
		<script language="javascript">
		  function check(){	  
		   var username=document.getElementById("user").value;
		   var password=document.getElementById("pass").value;	   		   
		   var a=document.getElementById("checkValue").value;//用于得到输入框所输入值
		    if(username!=''){
		      if(password!=''){
		        if(a!=''){
		          var b=0;
		          b = codes.join("");//用于数组转换字符串
		          if(b!=a)
		          {alert("验证码错误,请重新输入！");}
		          else{
		           if(username!="phi")
		            alert("用户名不存在");
		          }
		        }else{
		          alert("验证码不能为空");
		        }
		      }else{
		       alert("密码不能为空");
		      }
		    }else{
		       alert("用户名不能为空");
		    }
		  }
		</script>	
	</head>
	<body>
		<div align="right">
			<table cellspacing=0 cellpadding=0 style="width:350px;font-size:10pt;">
				<tr valign=top>
					<td width="100px">
						语言选择&nbsp;
					</td>
					<td>
						<select size="1" style="width: 100px; height: 30px;">
							<option>
								简体中文
							</option>
							<option>
								ENGLISH
							</option>
							<option></option>
						</select>
						&nbsp;&nbsp;&nbsp;
					</td>
					<td>
						&nbsp;&nbsp;
						<img src="images/BTN_BASE_USER.gif" height=18px
							class="xiaotubiao"/>
					</td>
					<td width="40px">
						关于
					</td>
					<td>
						&nbsp;&nbsp;
						<img src="images/help.gif" class="xiaotubiao"/>
					</td>
					<td width="40px">
						帮助
					</td>
					<td width="30px"></td>
				</tr>
			</table>
		</div>
	<s:form action="login" method="post">
		<div id="login">
			<table border=0px cellpadding=4px>
				<tr>
					<td width="100px">
						帐&nbsp;&nbsp;套
					</td>
					<td colspan="2" width="200px">
						<select size="1" style="width: 200px; height: 34x;">
							<option>
								&nbsp;
							</option>
							<option>
								phi
							</option>
							<option>
								系统管理
							</option>
						</select>
					</td>
					<td></td>
				</tr>
				<!--
				<tr height="25px">
					<td>
				公&nbsp;&nbsp;司
				</td>
				<td align=left colspan="2" >
					<div id="border" height="30px">
						<div height="20px" style="float:left;">
							<input type=text  style="border:0; height:16px;" size="24">
						</div>
						<input type="image" src="../images/lookup.gif" id="find" onclick="showCompany()" onFocus="this.blur()" onmouseover="this.className='mainhover'" onmouseout="this.className=''">
					</div>
				</td>
				<td rowspan="5" valign="top">
						<div id="company">
							<div width=100% align="right">
								<input type="image" src="../images/close.gif" onclick="showCompany()">
							</div>
							<div>
							</div>
							<div>
							</div>
						</div>
					</td>
				</tr>
				-->
				<tr>
					<td>
						用&nbsp;&nbsp;户
					</td>
					<td colspan="2">
						<input id="user" name="user" type="text" value="" size="27" 	style="height: 22px;" />
					</td>
				</tr>
				<tr>
					<td>
						密&nbsp;&nbsp;码
					</td>
					<td colspan="2">
						<input id="pass" name="pass" type="password" value="" size="29"
							style="height: 22px;" />
					</td>
				</tr>
				<tr align="left">
					<td align="center">
						验证码
					</td>
					<td>
						<input type="text" id="checkValue" size="12" style="height: 22px;"/>
					</td>
					<td>
						<div id="divCode" class="checkcode">
							<span></span>
							<span></span>
							<span></span>
							<span></span>
						</div>
						<input type="image" src="images/change.png"
							onclick="validteCode()" id="change" onFocus="this.blur()" />
					</td>
				</tr>
				<tr>
					<td>
						&nbsp;
					</td>
					<td align="left" width="100px">
						<input id="land" name="land" type="submit" onFocus="this.blur()"
							onmouseover="this.className='loginbtnover'"
							onmouseout="this.className='loginbtnout'" class="loginbtnsize"
							value="&nbsp;登&nbsp;&nbsp;陆&nbsp;" onclick="check()" />
					</td>
					<td>
						<input id="option" name="option" type="button"
							onFocus="this.blur()" onmouseover="this.className='loginbtnover'"
							onmouseout="this.className='loginbtnout'" class="loginbtnsize"
							value="&nbsp;选&nbsp;&nbsp;项&nbsp;" />
					</td>
				</tr>
				<tr>
				</tr>
			</table>
		</div>
   </s:form>
	</body>
</html>
<script language="JavaScript" type="text/javascript">
	 var codes = new Array(4);       //用于存储随机验证码

function validteCode()
{		
    var colors = new Array("Red","Green","Gray","Blue","Maroon","Aqua","Fuchsia","Lime","Olive","Silver");
    for(var i=0;i < codes.length;i++)
    {//获取随机验证码
        codes[i] = Math.floor(Math.random()*10);
       
    }
    var spans = document.getElementById("divCode").all;
    for(var i=0;i<spans.length;i++)
    {
        spans[i].innerHTML=codes[i];
        spans[i].style.color = colors[Math.floor(Math.random()*10)];    //随机设置验证码颜色
    }
}
document.onload = validteCode();
</script>